package com.zy.openchat.core.model.circle;

import com.google.gson.annotations.SerializedName;
import com.ja.openchat.ui.found.WhoLookActivity;
import com.zy.openchat.core.model.message.ChatInfo;
import com.zy.openchat.core.model.user.UserInfo;
import com.zy.openchat.util.Common;

import java.util.ArrayList;
import java.util.List;

public class VisibleTypeInfo {
    @SerializedName(value = "@type")
    public String type;
    public List<Long> tags;
    public List<Long> users;
    public List<Long> groups;

    public VisibleTypeInfo(int chooseWhoLookType, ArrayList<UserInfo> chooseUsers,ArrayList<ChatInfo> groupInfos,ArrayList<UserTags> chooseTags) {
        switch (chooseWhoLookType){
            case WhoLookActivity.WHO_LOOK_TYPE_PUBLIC_ALL:
                type = "visibleTypePublic";
                break;
            case WhoLookActivity.WHO_LOOK_TYPE_PUBLIC_FRIENDS:
                type = "visibleTypeFriend";
                break;
            case WhoLookActivity.WHO_LOOK_TYPE_PRIVTE:
                type = "visibleTypePrivate";
                break;
            case WhoLookActivity.WHO_LOOK_TYPE_ALLOW_VISIBLE:
            case WhoLookActivity.WHO_LOOK_TYPE_DISALLOW_VISIBLE:
                type = chooseWhoLookType == WhoLookActivity.WHO_LOOK_TYPE_ALLOW_VISIBLE?"visibleTypeAllow":"visibleTypeNotAllow";
                if(!Common.isEmpty(chooseUsers)){
                    users = new ArrayList<>();
                    for(UserInfo userInfo:chooseUsers){
                        users.add(userInfo.id);
                    }
                }
                if(!Common.isEmpty(chooseTags)){
                    tags = new ArrayList<>();
                    for(UserTags userTags:chooseTags){
                        tags.add(userTags.id);
                    }
                }
                if(!Common.isEmpty(groupInfos)){
                    groups = new ArrayList<>();
                    for(ChatInfo chatInfo:groupInfos){
                        groups.add(chatInfo.id);
                    }
                }
                break;

        }
    }
}
